package nimbus.events
{
	import flash.events.Event;
	
	import nimbus.commands.ICommand;
	
	/**
	 * Allows an Event to store a corresponding command.
	 */
	public class ControllerEvent extends Event
	{
		private var _command:ICommand;				// internal command stored on the Event
		private var _isUndo:Boolean;				// internal isUndo stored on the Event
		private var _canceled:Boolean = false;
		
		/**
		 * A regular non-bubbling event except with a command attached.
		 */
		public function ControllerEvent(type:String, command:ICommand, canceled:Boolean = false, 
                isUndo:Boolean = false)
		{
			super(type);
			_command = command;
			_canceled = canceled;
			_isUndo = isUndo;
		}
		
		/**
		 * retrieves the command from the Event object as a read-only.
		 */
		public function get command():ICommand
		{
			return _command;
		}
		
		/**
		 * Is this event a result of an undo?
		 */
		public function get isUndo():Boolean
		{
			return _isUndo;
		}
		
		public function get canceled():Boolean
		{
			return _canceled;
		}
		
	}
}
